using System; using System.Xml; using System.IO; using System.Xml.XPath; using System.Xml.Xsl; using Syndication.Extensibility; using System.Windows.Forms; using System.Diagnostics; using Microsoft.Win32; namespace BlogExtension.BlogThis.WBloggar { public class BlogThisUsingWbloggarPlugin:IBlogExtension { public static string styleSheet = @" RE: <xsl:value-of select='title' />
[Via ]
"; public bool HasConfiguration { get {return false; } } public bool HasEditingGUI{ get {return true; } } public void Configure(IWin32Window parent){ /* yeah, right */ } public string DisplayName { get { return Resource.Manager["RES_MenuWBloggarCaption"]; } } public void BlogItem(System.Xml.XPath.IXPathNavigable rssFragment, bool edited) { /* check to see if w::bloggar installed */ RegistryKey rkey; rkey = Registry.CurrentUser.OpenSubKey(@"Software\VB and VBA Program Settings\Bloggar"); if(rkey == null){ throw new ApplicationException(Resource.Manager["RES_ExceptionWBloggarNotFound"]); } string wbloggarPath = ((string) rkey.GetValue("InstallPath")); XslTransform transform = new XslTransform(); transform.Load(new XmlTextReader(new StringReader(styleSheet))); string tempfile = Path.GetTempFileName(); transform.Transform(rssFragment, null, new StreamWriter(tempfile)); Process.Start(wbloggarPath + @"\wbloggar.exe", tempfile); } public static void Main(string[] args){ BlogThisUsingWbloggarPlugin plugin = new BlogThisUsingWbloggarPlugin(); plugin.BlogItem(new XPathDocument("rssitem2.xml"), false); } } }